package com.itheima.Demo;

public class Test3 {
    public static void main(String[] args) {
        System.out.println(getcode(4));
        System.out.println(getcode(5));
    }
    public static  String getcode(int n) {
        String code = "";
        for (int i = 0; i < n; i++) {
            int type = (int)(Math.random()*3);
            switch (type) {
                case 0:
                    code += (char)(Math.random()*26+'a');
                    break;
                case 1:
                    code += (char)(Math.random()*26+'A');
                    break;
                case 2:
                    code += (int)(Math.random()*10);
                    break;
            }
        }
        return code;
    }
}
